<?php
namespace App\Logics;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\Models\GoodsSkuModel;

//逻辑处理
class GoodsSkuLogic extends BaseLogic {


    public function __construct()
    {
        parent::__construct();

    }


    /** 根据商品id获取对应的sku
     * @param int $goods_id
     * @param array $fields
     * @return mixed
     */
    public static function getListByGoodsId(int $goods_id,$fields=['*']){
        $data= GoodsSkuModel::where('goods_id',$goods_id)->select($fields)->get();
        return ob_to_array($data);
    }

    public static function getOne(int $id,$fields=['*']){
        $data= GoodsSkuModel::where('id',$id)->select($fields)->first();
        return ob_to_array($data);
    }

    public static function getCountById(int $id){
        return  GoodsSkuModel::where('id',$id)->count();
    }





}
